<?php
$page = 'admin';
require_once 'header.php';
$course = $_GET['status'];
include '../database/connect.php';
if (isset($_GET['save'])) {
    session_start();
    extract($_POST);
    $added_by = $_SESSION['username'];
    $query = "INSERT INTO lessons SET course='$course', topic='$topic', content='$content',added_by='$added_by'";
    mysql_query($query) or die("Error executing '$query':" . mysql_error());
    header("Location: quizes.php");
}
?>
<form action="?save=1" method="POST" id="quiz_form">
    <table >
        <tr>
            <td>Lesson</td>
            <td>
                <?php
                $query = "SELECT * FROM lessons order by topic asc";
                
                $result = mysql_query($query) or die("Error executing '$query':" . mysql_error());
               
                echo '<select name="course">';
                while ($row = mysql_fetch_array($result)) {
                    echo "<option value='" . $row['lessons'] . "'>" . $row['lessons'] . "</option>";
                }

                echo '</select>'; // Close your drop down box
                ?>
            </td>

            <td>Description</td>
            <td><input type="text" class="validate[required] wide" name="description" id='description' /></td>

            <td ><input type="submit"/></td>
        </tr>
    </table>
</form>
<?php require_once 'footer.php';?>